<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.sql.*,java.util.*,com.bean.*,com.utils.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>在此处插入标题</title>
<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<%
	//查看该学生的考试科目
	String stu_id = (String) session.getAttribute("stu_id");
	String examname = "";
	List<Student> list = DaoFactory.getStudentDaoInstance().allstudentsearch();
	for (Student student : list) {
		if (student.getStu_id().equals(stu_id)) {
			examname = student.getStu_exam();
			session.setAttribute("examname", examname);
		}
	}
%>
<script type="text/javascript">
	//每1000ms更新一次学生试卷提交情况
	$(function() {
		setInterval("showInfo()", 10000000);
	});
	//查看学生试卷更新的的情况，并修改当前页面的信息
	function showInfo() {
		$.ajax({
			type : "post",
			url : "../ShowInformation",
			success : function(text) {
				$("#show").html(text);
			}
		});
	}
	//空文件不予上传
	function checkupload() {
		var file = document.getElementById("file").value;
		if (file == null || file == "")
			return false;
		else
			return true;
	}
</script>
<jsp:include page="student_head.jsp"></jsp:include>
	<div class="container">
		<div class="row">
			<div class="col-md-6">
				<div class="alert navbar-inverse " style="background-color: #e0e0e0; height: 350px; margin-top: 20px;">
					<h3>
						<strong>试卷下载</strong>
					</h3>
					<div class="alert" style="display:<%if (!examname.equals("")) out.print("none");%> ;background-color: gray;">
						<span style="color: white;">本次考试没有电子试卷</span>
					</div>
					<a class="btn btn-default" href="../ExamDownload" style="display: <%if (examname.equals("")) out.print("none");%>">
						<span class="glyphicon glyphicon-eye-open"></span>下载查看
					</a>
				</div>
			</div>
			<div class="col-md-6">
				<div class="alert navbar-inverse " style="background-color: #e0e0e0; height: 350px; margin-top: 20px;">
					<h3>
						<strong>答案上传</strong>
					</h3>
					<span>请按照考试要求将答案文件打包，再次进行上传。同名文件多次上传将会覆盖。</span>
					<form class="form-inline" name="file" role="form" action="../StudentUpload" enctype="multipart/form-data" method="post">
						<input type="file" id="file" name="file">
						<button type="submit" onclick="return checkupload()" style="margin-top: 10px;" class="btn btn-info">
							上传
						</button>
					</form>
				</div>
			</div>
		</div>

		<div class="col-md-6">
			<table id="show" class="table" style="color: red">
			</table>
		</div>

	</div>
</body>
</html>